package com.bupt.secret.utils;

import java.io.InputStream;
import java.util.Properties;

/**
 * @desc 读取配置文件
 * @author shishumin
 * @date 2024/9/4 20:59
 */
public class PropertyUtil {

    /**
     * @desc 加载配置文件
     * @author shishumin
     * @date 2024/9/5 08:41
     */
    public static String loadProperties(String name) {
        Properties prop = new Properties();
        InputStream inputStream = PropertyUtil.class.getClassLoader().getResourceAsStream("application.properties");

        if (inputStream != null) {
            try {
                prop.load(inputStream);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return prop.getProperty(name);
    }

}
